home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / tsr21src.arc / MARK.ASM < prev    next >
Assembly Source File  |  1986-07-20  |  3KB  |  92 lines

  1. ;MARK.ASM - mark a position in memory,
  2. ;           above which TSRs will later be cleared by RELEASE.COM
  3. ;           MARK can be called multiple times, each RELEASE will clear
  4. ;           above the last MARK called.
  5. ;
  6. ; VERSION 1.4  2/23/86
  7. ;   This version also stores the EMS page map so that RELEASE can release
  8. ;   READY! and any future resident programs using expanded memory
  9. ; VERSION 1.5  2/28/86
  10. ;   to keep consistent with MAPMEM and RELEASE
  11. ; VERSION 1.6  3/8/86
  12. ;   store all 256 interrupts, but only 32 EMS blocks
  13. ; VERSION 1.7  4/1/86
  14. ;   close the EMS handle opened to avoid using up a DOS handle
  15. ; VERSION 1.8  4/20/86
  16. ;   to keep consistent with MAPMEM and RELEASE
  17. ; VERSION 1.9  5/22/86
  18. ;   to keep consistent with MAPMEM and RELEASE
  19. ; VERSION 2.0  5/26/86
  20. ;   to keep consistent with MAPMEM and RELEASE
  21. ; VERSION 2.1  7/18/86
  22. ;   to keep consistent with RELEASE
  23. ;
  24. ; If MARK is called with something on the command line, that text will
  25. ; be stored in the program segment prefix at offset 80H, where it is
  26. ; later accessible to RELEASE for a "named" release.
  27. ;
  28. ; written for CHASM (CHeap ASseMbler)
  29. ; by Kim Kokkonen, TurboPower Software
  30. ; telephone: 408-378-3672, Compuserve 72457,2131
  31. ;
  32. mark   proc    near
  33.        jmp     install
  34.  
  35. idstr  db      'MARK PARAMETER BLOCK FOLLOWS' ;used to find this TSR
  36. dummy  db      0               ;puts vector table on an even paragraph boundary
  37. vector ds      400H,0          ;holds vector table (0..FF)*4 at invocation time
  38. emscnt db      0,0             ;holds number of active pages in map that follows
  39. emsmap ds      80H,0           ;holds EMS page map if installed
  40.  
  41. install
  42. ;store the interrupt vector table
  43.        push    ds
  44.        mov     cx,200H         ;512 integers to store
  45.        xor     ax,ax
  46.        mov     ds,ax           ;source address segment 0
  47.        xor     si,si           ;offset 0
  48.        mov     di,offset(vector) ;destination offset, es=cs already
  49.        cld                     ;copy up
  50.        rep
  51.        movsw                   ;copy vectors to our table
  52.  
  53. ;determine whether EMS is present
  54.        pop     ds
  55.        mov     dx,offset(emsnm)
  56.        mov     ax,3D00H
  57.        int     21H
  58.        jb      gores           ;ems driver not installed
  59.  
  60. ;EMS present, close the open handle first
  61.        mov     bx,ax
  62.        mov     ah,3EH
  63.        int     21H
  64.  
  65. ;store the EMS page map
  66.        mov     ah,4DH
  67.        mov     di,offset(emsmap) ;es=cs already
  68.        xor     bx,bx
  69.        int     67H
  70.        cmp     ah,0
  71.        jnz     gores           ;error, ignore this step
  72.  
  73. ;store the number of active handles
  74.        mov     emscnt,bx       ;count of active handles
  75.  
  76. ;print message and TSR
  77. gores  mov     dx,offset(didit)
  78.        mov     ah,9
  79.        int     21H             ;write success message
  80.        mov     dx,offset(install) ;get end of resident portion
  81.        mov     cx,4
  82.        shr     dx,cl           ;convert to paragraphs
  83.        inc     dx              ;round up
  84.        mov     ax,3100H
  85.        int     21H             ;terminate and stay resident
  86.        endp
  87.  
  88. ;success message and version number
  89. didit  db      13,10,'MARK 2.1 - Marked current memory position',13,10,36
  90. ;file name for testing EMS presence
  91. emsnm  db      'EMMXXXX0',0
  92.